package com.example.demo.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 汽车订单2表
 * 
 * @author 吕佳辉
 *
 */
@Entity
public class CarsOrder2 {

	private Integer id;

	private String dept;// 所属部门
	private String zhiwei;// 职位
	private String zhuanjieshao;// 是否为转介绍

	private Date dingDate;// 订车日期

	private Date jiaoDate;// 交车日期

	private List<NewCar1> cars = new ArrayList<>();// 拟购车型
	
	private List<UsedCar1> cars2=new ArrayList<UsedCar1>();//拟购二手车型

	private String contractNO;// 合同编号
	private String color;// 颜色
	private String heGeZhengNum;// 合格证
	private String faPiaoNum;// 发票号码
	private String faDongJi;// 发动机号
	private String cheJia;// 车架号
	private Integer xiaoShouPrice;// 销售价格

	private List<SaleBoutique1> zengJingPin = new ArrayList<>();// 赠送精品

	private List<CarKeep> zengBaoYang = new ArrayList<>();// 赠送保养套餐

	private List<YanBao> zengYanBao = new ArrayList<>();// 赠送延保

	private List<XiMei> zengXiMei = new ArrayList<>();// 赠送洗美

	private List<Insurance> zengBaoXian = new ArrayList<>();// 赠送保险

	private List<MoneyCompany> zengJinRong = new ArrayList<>();// 赠送金融

	private List<CarNumberCompany1> zengChePai = new ArrayList<>();// 赠送车牌

	private Float zengJiaoQiang;// 赠交强险

	private Float zengShangYeXian;// 赠交强险

	private Integer zengPrice;// 赠送总金额

	private List<SaleBoutique1> maiJingPin = new ArrayList<>();// 销售精品

	private List<CarKeep> maiBaoYang = new ArrayList<>();// 销售保养套餐

	private List<YanBao> maiYanBao = new ArrayList<>();// 销售延保

	private List<XiMei> maiXiMei = new ArrayList<>();// 销售洗美

	private List<Insurance> maiBaoXian = new ArrayList<>();// 销售保险

	private List<MoneyCompany> maiJinRong = new ArrayList<>();// 销售金融

	private List<CarNumberCompany1> maiChePai = new ArrayList<>();// 销售车牌

	private Float maiJiaoQiang;// 销交强险

	private Float maiShangYeXian;// 销商业险

	private Integer maiPrice;// 销售总金额

	private String twoCompanyName;// 二手公司名称

	private Integer twoCompanyPrice;// 二手公司信息返利

	private Date beginDate;// 开始修改日期

	private Date endDate;// 结束修改日期

	private CarsOrder carsorder;// 绑定1表

	private Float zengSongJinRongMoney;// 赠送金融金额

	private Float xiaoShouJinRongMoney;// 销售金融金额

	private Float zengSongChePaiMoney;// 赠送车牌金额

	private Float xiaoShouChePaiMoney;// 销售车牌金额

	public Float getZengSongJinRongMoney() {
		return zengSongJinRongMoney;
	}

	public void setZengSongJinRongMoney(Float zengSongJinRongMoney) {
		this.zengSongJinRongMoney = zengSongJinRongMoney;
	}

	public Float getXiaoShouJinRongMoney() {
		return xiaoShouJinRongMoney;
	}

	public void setXiaoShouJinRongMoney(Float xiaoShouJinRongMoney) {
		this.xiaoShouJinRongMoney = xiaoShouJinRongMoney;
	}

	public Float getZengJiaoQiang() {
		return zengJiaoQiang;
	}

	public void setZengJiaoQiang(Float zengJiaoQiang) {
		this.zengJiaoQiang = zengJiaoQiang;
	}

	public Float getZengShangYeXian() {
		return zengShangYeXian;
	}

	public void setZengShangYeXian(Float zengShangYeXian) {
		this.zengShangYeXian = zengShangYeXian;
	}

	public Float getMaiJiaoQiang() {
		return maiJiaoQiang;
	}

	public void setMaiJiaoQiang(Float maiJiaoQiang) {
		this.maiJiaoQiang = maiJiaoQiang;
	}

	public Float getMaiShangYeXian() {
		return maiShangYeXian;
	}

	public void setMaiShangYeXian(Float maiShangYeXian) {
		this.maiShangYeXian = maiShangYeXian;
	}

	@Id
	@GeneratedValue
	@JsonIgnore
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDept() {
		return dept;
	}

	public void setDept(String dept) {
		this.dept = dept;
	}

	public String getZhiwei() {
		return zhiwei;
	}

	public void setZhiwei(String zhiwei) {
		this.zhiwei = zhiwei;
	}

	public String getZhuanjieshao() {
		return zhuanjieshao;
	}

	public void setZhuanjieshao(String zhuanjieshao) {
		this.zhuanjieshao = zhuanjieshao;
	}

	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDingDate() {
		return dingDate;
	}

	public void setDingDate(Date dingDate) {
		this.dingDate = dingDate;
	}

	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getJiaoDate() {
		return jiaoDate;
	}

	public void setJiaoDate(Date jiaoDate) {
		this.jiaoDate = jiaoDate;
	}

	@ManyToMany
	public List<NewCar1> getCars() {
		return cars;
	}

	public void setCars(List<NewCar1> cars) {
		this.cars = cars;
	}

	public String getContractNO() {
		return contractNO;
	}

	public void setContractNO(String contractNO) {
		this.contractNO = contractNO;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getHeGeZhengNum() {
		return heGeZhengNum;
	}

	public void setHeGeZhengNum(String heGeZhengNum) {
		this.heGeZhengNum = heGeZhengNum;
	}

	public String getFaPiaoNum() {
		return faPiaoNum;
	}

	public void setFaPiaoNum(String faPiaoNum) {
		this.faPiaoNum = faPiaoNum;
	}

	public String getFaDongJi() {
		return faDongJi;
	}

	public void setFaDongJi(String faDongJi) {
		this.faDongJi = faDongJi;
	}

	public String getCheJia() {
		return cheJia;
	}

	public void setCheJia(String cheJia) {
		this.cheJia = cheJia;
	}

	public Integer getXiaoShouPrice() {
		return xiaoShouPrice;
	}

	public void setXiaoShouPrice(Integer xiaoShouPrice) {
		this.xiaoShouPrice = xiaoShouPrice;
	}

	@ManyToMany
	public List<SaleBoutique1> getZengJingPin() {
		return zengJingPin;
	}

	public void setZengJingPin(List<SaleBoutique1> zengJingPin) {
		this.zengJingPin = zengJingPin;
	}

	@ManyToMany
	public List<CarKeep> getZengBaoYang() {
		return zengBaoYang;
	}

	public void setZengBaoYang(List<CarKeep> zengBaoYang) {
		this.zengBaoYang = zengBaoYang;
	}

	@ManyToMany
	public List<YanBao> getZengYanBao() {
		return zengYanBao;
	}

	public void setZengYanBao(List<YanBao> zengYanBao) {
		this.zengYanBao = zengYanBao;
	}

	@ManyToMany
	public List<XiMei> getZengXiMei() {
		return zengXiMei;
	}

	public void setZengXiMei(List<XiMei> zengXiMei) {
		this.zengXiMei = zengXiMei;
	}

	@ManyToMany
	public List<Insurance> getZengBaoXian() {
		return zengBaoXian;
	}

	public void setZengBaoXian(List<Insurance> zengBaoXian) {
		this.zengBaoXian = zengBaoXian;
	}

	@ManyToMany
	public List<MoneyCompany> getZengJinRong() {
		return zengJinRong;
	}

	public void setZengJinRong(List<MoneyCompany> zengJinRong) {
		this.zengJinRong = zengJinRong;
	}

	public Integer getZengPrice() {
		return zengPrice;
	}

	public void setZengPrice(Integer zengPrice) {
		this.zengPrice = zengPrice;
	}

	@ManyToMany
	public List<SaleBoutique1> getMaiJingPin() {
		return maiJingPin;
	}

	public void setMaiJingPin(List<SaleBoutique1> maiJingPin) {
		this.maiJingPin = maiJingPin;
	}

	@ManyToMany
	public List<CarKeep> getMaiBaoYang() {
		return maiBaoYang;
	}

	public void setMaiBaoYang(List<CarKeep> maiBaoYang) {
		this.maiBaoYang = maiBaoYang;
	}

	@ManyToMany
	public List<YanBao> getMaiYanBao() {
		return maiYanBao;
	}

	public void setMaiYanBao(List<YanBao> maiYanBao) {
		this.maiYanBao = maiYanBao;
	}

	@ManyToMany
	public List<XiMei> getMaiXiMei() {
		return maiXiMei;
	}

	public void setMaiXiMei(List<XiMei> maiXiMei) {
		this.maiXiMei = maiXiMei;
	}

	@ManyToMany
	public List<Insurance> getMaiBaoXian() {
		return maiBaoXian;
	}

	public void setMaiBaoXian(List<Insurance> maiBaoXian) {
		this.maiBaoXian = maiBaoXian;
	}

	@ManyToMany
	public List<MoneyCompany> getMaiJinRong() {
		return maiJinRong;
	}

	public void setMaiJinRong(List<MoneyCompany> maiJinRong) {
		this.maiJinRong = maiJinRong;
	}

	public Integer getMaiPrice() {
		return maiPrice;
	}

	public void setMaiPrice(Integer maiPrice) {
		this.maiPrice = maiPrice;
	}

	public String getTwoCompanyName() {
		return twoCompanyName;
	}

	public void setTwoCompanyName(String twoCompanyName) {
		this.twoCompanyName = twoCompanyName;
	}

	public Integer getTwoCompanyPrice() {
		return twoCompanyPrice;
	}

	public void setTwoCompanyPrice(Integer twoCompanyPrice) {
		this.twoCompanyPrice = twoCompanyPrice;
	}

	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getBeginDate() {
		return beginDate;
	}

	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}

	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	@ManyToOne
	public CarsOrder getCarsorder() {
		return carsorder;
	}

	public void setCarsorder(CarsOrder carsorder) {
		this.carsorder = carsorder;
	}

	
	
	@ManyToMany
	public List<CarNumberCompany1> getZengChePai() {
		return zengChePai;
	}
	public void setZengChePai(List<CarNumberCompany1> zengChePai) {
		this.zengChePai = zengChePai;
	}

	@ManyToMany
	public List<CarNumberCompany1> getMaiChePai() {
		return maiChePai;
	}
	public void setMaiChePai(List<CarNumberCompany1> maiChePai) {
		this.maiChePai = maiChePai;
	}

	public Float getZengSongChePaiMoney() {
		return zengSongChePaiMoney;
	}

	public void setZengSongChePaiMoney(Float zengSongChePaiMoney) {
		this.zengSongChePaiMoney = zengSongChePaiMoney;
	}

	public Float getXiaoShouChePaiMoney() {
		return xiaoShouChePaiMoney;
	}

	public void setXiaoShouChePaiMoney(Float xiaoShouChePaiMoney) {
		this.xiaoShouChePaiMoney = xiaoShouChePaiMoney;
	}






	@ManyToMany
	public List<UsedCar1> getCars2() {
		return cars2;
	}

	public void setCars2(List<UsedCar1> cars2) {
		this.cars2 = cars2;
	}

	@Transient
	public String getCarsId() {
		String str = "";
		for (NewCar1 car : getCars()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getZengJingPinId() {
		String str = "";
		for (SaleBoutique1 car : getZengJingPin()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getZengBaoYangId() {
		String str = "";
		for (CarKeep car : getZengBaoYang()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getzengYanBaoId() {
		String str = "";
		for (YanBao car : getZengYanBao()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getZengXiMeiId() {
		String str = "";
		for (XiMei car : getZengXiMei()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getZengBaoXianId() {
		String str = "";
		for (Insurance car : getZengBaoXian()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getZengJinRongId() {
		String str = "";
		for (MoneyCompany car : getZengJinRong()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getMaiJingPinId() {
		String str = "";
		for (SaleBoutique1 car : getMaiJingPin()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getMaiBaoYangId() {
		String str = "";
		for (CarKeep car : getMaiBaoYang()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getMaiYanBaoId() {
		String str = "";
		for (YanBao car : getMaiYanBao()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getMaiXiMeiId() {
		String str = "";
		for (XiMei car : getMaiXiMei()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getMaiBaoXianId() {
		String str = "";
		for (Insurance car : getMaiBaoXian()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public String getMaiJinRongId() {
		String str = "";
		for (MoneyCompany car : getMaiJinRong()) {
			str += car.getId() + ",";
		}
		if (str.indexOf(",") > 0) {
			str = str.substring(0, str.length() - 1);
		}
		return str;
	}

	@Transient
	public Integer getCarsorderId() {
		return carsorder == null ? null : carsorder.getId();
	}

}
